cmake_minimum_required(VERSION 2.8.3)
FIND_PACKAGE(PythonInterp)
if(PYTHONINTERP_FOUND)
    if(PYTHON_VERSION_MAJOR EQUAL 3)
        FIND_PACKAGE(Boost COMPONENTS "python${PYTHON_VERSION_MAJOR}")
        FIND_PACKAGE(PythonInterp 3)
        FIND_PACKAGE(PythonLibs 3 REQUIRED)
    else()
        message("python is not 3")
    endif()
else()
    message("python is not found")
endif()

message(STATUS "PYTHON_LIBRARIES=${PYTHON_LIBRARIES}")
message(STATUS "PYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}")
message(STATUS "PYTHON_VERSION_MAJOR=${PYTHON_VERSION_MAJOR}")
message(STATUS "PYTHON_INCLUDE_DIRS=${PYTHON_INCLUDE_DIRS}")
message(STATUS "Boost_LIBRARIES=${Boost_LIBRARIES}")
message(STATUS "Boost_INCLUDE_DIRS=${Boost_INCLUDE_DIRS}")

#set(CXX_FLAGS -fPIC)
include_directories(${PYTHON_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS})
link_directories(${Boost_LIBRARIES})
enable_testing()

PYTHON_ADD_MODULE(c_test_boost_python test_boost_python.cpp)
target_link_libraries(c_test_boost_python ${Boost_LIBRARIES} ${PYTHON_LIBRARIES})
file(COPY test_boost_python.py DESTINATION .)
add_test(NAME check_test_boost_python COMMAND ${PYTHON_EXECUTABLE} test_boost_python.py)
